<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/login2.css">
<link href="css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="js/jquery.min.js"></script>
    <!-- 引入我们的favicon首页图标 -->
    <link rel="shortcut icon" href="favicon.ico" />

<title>MYSHOP商城首页</title>
    <script type="text/javascript">
        $(document).ready(function(){
            $.ajax({
                url:"${pageContext.request.contextPath}/type?method=findAll",
                type:"GET",
                dataType:"json",
                success:function(data){
                    for(var i in data){
                        var a = $("<a href='${pageContext.request.contextPath}/product?method=show&tid="+data[i].tid+"'>"+data[i].tname+"</a>");
                        $("#goodsType").append(a);

                    }
                },
                error:function(){
                    alert("失败");
                }
            })
        })
    </script>
    <!-- Link Swiper's CSS -->
    <link rel="stylesheet" href="css/swiper.min.css" />
    <!-- Demo styles -->
    <style>
        html, body {
            position: relative;
            height: 100%;
        }
        body {
            background: #eee;
            font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
            font-size: 14px;
            color:#000;
            margin: 0;
            padding: 0;
        }
        .swiper-container {
            width: 100%;
            height: 100%;
            margin-left: auto;
            margin-right: auto;
        }
        .swiper-slide {
            text-align: center;
            font-size: 18px;
            background: #fff;

            /* Center slide text vertically */
            display: -webkit-box;
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
            -webkit-box-pack: center;
            -ms-flex-pack: center;
            -webkit-justify-content: center;
            justify-content: center;
            -webkit-box-align: center;
            -ms-flex-align: center;
            -webkit-align-items: center;
            align-items: center;
        }
    </style>
</head>
<body>
<div id="top">
    <div id="topdiv">
            <span>
                <a href="index.jsp" id="a_top" target="_blank">Myshopping商城</a>
            </span>

        <span style="float:right">
           		<c:if test="${empty loginUser}">
                    <a href="login.jsp" id="a_top">登录</a>
                    <li>|</li>
                    <a href="register.jsp" id="a_top">注册</a>
                </c:if>
       			<c:if test="${not empty loginUser}">
                    <a href="user?method=selectUserByUid" id="a_top">${loginUser.username}</a>
                    <li>|</li>
                    <a href="user?method=logOut" id="a_top">注销</a>
                    <li>|</li>
                    <a href="order?method=show" id="a_top">我的订单</a>
                    <li>|</li>
                    <a href="address?method=show" id="a_top">地址管理</a>
                </c:if>
                <a href="${pageContext.request.contextPath}/cart?method=show&uid=${loginUser.uid}" id="shorpcar">购物车</a>
            </span>
    </div>
</div>
<div id="second">
    <a href="index.jsp" id="seimg" style=" margin-top:23px;"><img id="logo" src="image/logo.png" width="119.5" height="59"/></a>
    <p id="goodsType">
        <!-- 根据ajax 回调函数 填写数据 到此id中 -->
    </p>
    <form class="form-inline pull-right" style="margin-top: 40px;margin-right: 10px;" action="/product?method=likeshow&" method="post">

        <div class="form-group">
            <input type="text" class="form-control" style="width: 400px" name="str" placeholder="搜索一下好东西...">
        </div>
        <button type="submit" class="btn btn-warning"><span class="glyphicon glyphicon-search"></span>&nbsp;&nbsp;搜索</button>
    </form>
</div>
<!--网站中间内容开始-->
<div id="thred">
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">
                <a href="http://localhost:8080/product?method=detail&pid=5">
                    <img src="image/banner1.jpg" width="1230" height="460" />
                </a>
            </div>
            <div class="swiper-slide">
                <a href="http://localhost:8080/product?method=detail&pid=37">
                    <img src="image/banner2.jpg" width="1230" height="460" />
                </a>
            </div>
            <div class="swiper-slide">
                <a href="http://localhost:8080/product?method=detail&pid=38">
                    <img src="image/banner3.jpg" width="1230" height="460" />
                </a>
            </div>
            <div class="swiper-slide">
                <a href="http://localhost:8080/product?method=detail&pid=39">
                    <img src="image/banner4.gif" width="1230" height="460" />
                </a>
            </div>
            <div class="swiper-slide">
                <a href="http://localhost:8080/product?method=detail&pid=40">
                    <img src="image/banner5.jpg" width="1230" height="460" />
                </a>
            </div>
            <div class="swiper-slide">
                <a href="http://localhost:8080/product?method=detail&pid=41">
                    <img src="image/banner6.jpg" width="1230" height="460" />
                </a>
            </div>
        </div>
        <!-- Add Pagination -->
        <div class="swiper-pagination"></div>
        <!-- Add Arrows -->
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>
</div>
<!-- Swiper JS -->
<script src="js/swiper.min.js"></script>

<!-- Initialize Swiper -->
<script>
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        slidesPerView: 1,
        paginationClickable: true,
        spaceBetween: 30,
        loop: true
    });
</script>
</body>
</html>